package org.study.service.config;

import org.springframework.stereotype.Service;
import org.study.entity.ModuleMachineRoleEntity;
import org.study.service.IModuleMachineRoleService;

import java.util.ArrayList;
import java.util.List;

@Service("moduleMachineRoleServiceConfig")
public class ModuleMachineRoleServiceConfig implements IModuleMachineRoleService {
    @Override
    public List<ModuleMachineRoleEntity> selectByList(ModuleMachineRoleEntity entity) {
        List<ModuleMachineRoleEntity> list = new ArrayList<>();
        list.add(builder(1,"jdk","jdk"));
        list.add(builder(2,"jdk","jdk"));
        list.add(builder(3,"jdk","jdk"));
        list.add(builder(4,"jdk","jdk"));
        list.add(builder(5,"jdk","jdk"));
        list.add(builder(1,"hadoop","nameNode"));
        list.add(builder(2,"hadoop","nameNode"));
        list.add(builder(3,"hadoop","dataNode"));
        list.add(builder(4,"hadoop","dataNode"));
        list.add(builder(5,"hadoop","dataNode"));
        list.add(builder(1,"zookeeper","zookeeper"));
        list.add(builder(2,"zookeeper","zookeeper"));
        list.add(builder(3,"zookeeper","zookeeper"));
        return list;
    }
    private ModuleMachineRoleEntity builder(Integer machineId,String moduleName,String moduleRoue){
        ModuleMachineRoleEntity entity = new ModuleMachineRoleEntity();
        entity.setMachineId(machineId);
        entity.setModuleName(moduleName);
        entity.setModuleRole(moduleRoue);
        entity.setModuleId(0);
        return entity;
    }
}
